<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>根据数据生成柱形图</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            display: flex;
            justify-content: space-around;
            align-items: flex-end;
            width: 600px;
            height: 400px;
            border-left: 1px solid pink;
            border-bottom:1px solid pink ;
            margin: 100px auto;
        }
        .box>div{
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            width: 50px;
            height: 130px;
            background-color: pink;
            text-align: center;
        }
        .box>div span{
            margin-top: -20px;
        }
        .box>div h5{
            margin-bottom: -20px;
        }
    </style>
</head>
<body>
    <div class="box">
        <script>
            let num = +prompt('请输入你要输入几个季度？')
            let arr = [];
            for(let i = 1;i <= num;i++){
                arr.push(+prompt(`请输入第${i}季度的数据`))
            }
            for(let j = 0;j < arr.length;j++){
                document.write (`
                <div style="height:${arr[j]}px">
                    <span>${arr[j]}</span>
                    <h5>第${j+1}季度</h5>
                </div>  
                `) 
            }
            
        </script>
    </div>
</body>
</html>